//---------------------------------------------------------------------------

#pragma hdrstop

#include "MultiTimer.h"
#include "Configurator.h"

//---------------------------------------------------------------------------
UINT BarTimerID, PreOffTimerID, ComposeTimerID;
int TimerAccuracy;
int TimerInterval = 0;
bool TimerEnabled = false;

void TimerBeginPeriod()
{
	TIMECAPS timecaps;
	if (timeGetDevCaps(&timecaps,sizeof(TIMECAPS))==TIMERR_NOERROR)
	{
		TimerAccuracy = Min( Max(timecaps.wPeriodMin, Accuracy), timecaps.wPeriodMax);
	}

	timeBeginPeriod(TimerAccuracy);
}

void TimerEndPeriod()
{
	timeEndPeriod(TimerAccuracy);
}

void BarTimerStart()
{
	BarTimerID = timeSetEvent(TimerInterval, TimerAccuracy, &BarTimerCallProc, 1, TIME_PERIODIC);
}

void BarTimerStop()
{
	timeKillEvent(BarTimerID);
}

void PASCAL BarTimerCallProc(UINT TimerID, UINT msg,DWORD dwUser, DWORD dwa,DWORD dwb)
{
  FormMain->AccessReadBuf();
}
#pragma package(smart_init)
